import { SpriteFrame, resources, TiledMapAsset } from "cc";
import Singleton from "../../base/singleton"

export default class ResourceTiledMap extends Singleton {
    // 单例模式
    static get Instance(): ResourceTiledMap { return super.getInstance<ResourceTiledMap>(); } // 调用全局单例

    load(path: string, type: typeof TiledMapAsset = TiledMapAsset) {
        return new Promise<TiledMapAsset>((resolve, reject) => {
            // 加载 AnimationClip
            resources.load(path, type, (err, assets) => {
                if (err) return reject(err);
                resolve(assets);
            });
        });
    }
};